<template>
  <div>
        <span>总充值金额:{{sum || 0}}</span>
        <el-table
          :data="capital"
          border
          style="width: 100%">
          <el-table-column v-for="(item,index) in capitalTit" :key="index"
            :prop="item.prop"
            :label="item.label"
            :min-width="item.width">
          </el-table-column>
          <el-table-column
            label="状态">
            <template slot-scope="scope">
              <span v-html="scope.row.fZt"></span>
            </template>
          </el-table-column>
        </el-table>
        <div style="margin: 30px 0;">
          <el-pagination
          @current-change="handleCurrentChange"
          :page-size="pageSize"
          layout="prev, pager, next, jumper"
          :total="total">
          </el-pagination>
        </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      id:this.$route.params.id,
      capitalTit:[{
          prop:'id',
          label:'充值记录ID',
          width: '100'
        },{
          prop:'cUser',
          label:'用户名',
          width: '100'
        },{
          prop:'cZffs',
          label:'充值方式',
          width: '100'
        },{
          prop:'fCzje',
          label:'充值金额',
          width: '100'
        },{
          prop:'fSjje',
          label:'实际金额',
          width: '100'
        },{
          prop:'fSxf',
          label:'手续费',
          width: '100'
        },{
          prop:'tDate',
          label:'提交时间',
          width: '100'
        },{
          prop:'cOrdid',
          label:'订单号',
          width: '100'
        }
      ],
      capital:[],
      sum: 0,
      total: 0,
      pageSize: 20,
    }
  },
  methods: {
    handleCurrentChange(val) {
       this.getTableDate(val)
    },
    getTableDate (page=1) {
      this.$get(this,{api:'/member/czlist.do',data: {
        fuid:this.id,
        pageSize: this.pageSize,
        page
      }
      }).then(({data})=>{
        if (data.state === 0) {
          if (page == 1) {
            this.total = data.content.num;
            this.sum = data.content.sum;
          }
          this.capital = data.content.data;
        } else {
          this.$toast({
            message: data.message
          })
        }
      })
    }
  },
  mounted () {
    this.getTableDate(1);
  }
}
</script>


